
package com.example.tests;


import java.util.List;
import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

public class GroupCreationTests  extends TestBase {
	@Test
	public void testNonEmptyGroupCreation() throws Exception {
		app.getNavigationHelper().openMainPage();
		app.getNavigationHelper().gotoGroupPage();
		
		
		//save old state
		List<GroupData> oldList = app.getGroupHelper().getGroups();
		
		//some actions
		app.getGroupHelper().initGroupCreation();
		GroupData group = new GroupData();
		group.name = "group name 5";
		group.header = "header 5";
		group.footer = "footer 51";
		app.getGroupHelper().fillGroupForm(group);
		app.getGroupHelper().submitGroupCreation();
		app.getGroupHelper().returnGroupsPage();
		
		//save new state
		List<GroupData> newList = app.getGroupHelper().getGroups();
		
		//compare states
		assertEquals(newList.size(), oldList.size()+1);
		
	}
	
	//@Test
	public void testEmptyGroupCreation() throws Exception {
		app.getNavigationHelper().openMainPage();
		app.getNavigationHelper().gotoGroupPage();
		app.getGroupHelper().initGroupCreation();
		GroupData group = new GroupData();
		group.name = "";
		group.header = "";
		group.footer = "";
		app.getGroupHelper().fillGroupForm(group);
		app.getGroupHelper().submitGroupCreation();
		app.getGroupHelper().returnGroupsPage();
	}
}
